<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>

    </div>
    <script>
        // function fn(){
        //     var a = 10;
        //     function  foo(){
        //         console.log(a);
        //     }
        //     return foo;
        // }

        // var func = fn();
        // func();

        function fn(){
            var a=100;
            return{
                getter:function(){
                    console.log(a);
                },
                setter:function(b){
                    a=b;
                    console.log(a);
                }
            }
        }
        fn().getter();
        fn().setter(12);
    </script>
</body>
</html>